<?php
namespace App\Http\Controllers;

use App\Models\Matchset;
use Illuminate\Support\Facades\Schema;

class MatchsetController extends WxBaseController{
    protected $except=['index','show'];
    public function index($order='recommended'){
        $sets = Matchset::orderBy($order,'desc')->get();
        editImageUrl($sets);
        return $this->apiReturn(true,'success',$sets);
    }
    public function show($id){
        $set = Matchset::where('id',$id);
        //更新浏览量
        if(Schema::hasColumn('matchsets', 'watch')){
            $set->increment('watch');
        };
        $arr=$set->get();
        editImageUrl($arr);
        return $this->apiReturn(true,'success',$arr);
    }
}